package com.myapplication.ui.homefragment.shopfragment.activity_banner.activity_banner1;

import android.util.Log;

import com.myapplication.bean.DeatilBanner1;

import java.util.List;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * Created by zitaojiang on 2016/10/18.
 */
public class Presenter_Banner1 implements Contract_Banner1.Presenter {
    private Contract_Banner1.Model mModel=new Moedl_Banner1();
    private Contract_Banner1.View mView;
    private List<DeatilBanner1.RowsBean> mList;

    public Presenter_Banner1(Contract_Banner1.View mView) {
        this.mView = mView;
    }

    @Override
    public void putData() {
        mModel.getData(new Callback<DeatilBanner1>() {
            @Override
            public void onResponse(Call<DeatilBanner1> call, Response<DeatilBanner1> response) {
                mList=response.body().getRows();
                mView.onGetDataSuuessful_Banner1(mList);
                Log.i("tag2","--------"+mList.get(1).getName());
            }

            @Override
            public void onFailure(Call<DeatilBanner1> call, Throwable t) {
                    mView.onGetDataFail_Banner1(t.getMessage());
                Log.i("tag1", "onFailure: "+t.getMessage());
            }
        });
    }
}
